The Amiga's answer to Adobe Type Manager(tm) Amiga Typeface Engine (currently not tm because the name sucks.) Perpretrated by: Gordon Fecyk from Richmond, BC, Canada *********************************************************************** Table of Contents: 1) What is ATE and why is it better than bullet and type1.libraries? 2) System Requirements 3) Installing ATE (Assuming the good folks at AC didn't make an installer) 4) Running and using ATE with apps 5) Printing using ATE (suggestions are welcome here) 6) Bugs fixed since ATMbeta3d 7) Known bugs with ATEbeta4d 8) Future plans for commercial version (suggestions are also welcome here) *********************************************************************** What is this crazy thing you call ATE? ATE = "Amiga Typeface Engine" for now, but I can use suggestions for better names. ATE gives the Amiga the same (hopefully better!) PostScript typeface handling capabilities enjoyed by users of Adobe Type Manager (tm) for the Macintosh (tm) and Microsoft Windows (tm). Basically, you can use PostScript typefaces in any Amiga app whether it supports them or not, through the operating system, specifically graphics.library and diskfont.library. Why not CG fonts? Workbench 2.04 outline type handling was poor. It takes a good 12 seconds to load up a font from an outline on a 68030. It was also proprietary to AGFA's IntelliType typefaces, and you can't just go over to your local type dealer and buy AGFA typefaces. Why not type1.library? WB 2.1 and 3.0 allowed external engines for drawing outlines, and hence forth came type1.library. Not to knock type1, it is a lot more system- friendly than ATE :) but with system friendliness comes performance losses. type1 drew fonts even slower than the CG handler, bullet.library! PostScript is slow, I know, and this isn't type1's fault, but there had to be a better way! The better way comes from drawing characters only as needed. ATE's speed comes from keeping track of used characters in an active font. This means a Text() patch. Oh no, I hear all of you saying... what am I doing hacking up a most widely used function? I patched the Text() call in such a way that you'll never notice a performance difference on non-ATE fonts. Your terminal programs will still work full speed, and Workbench menus won't skip a beat. Here are some performance checks of ATE vs bullet.library. I used Prefs/Font to bring up a font from each engine. I used a 68030 and 68882 coprocessor, and the .2620 version of post.library, and drew the ATE and CG versions of Times-Roman: ATE CG ============================ (picked Size 24) 8 seconds 12 seconds (changed to 36) 5 seconds 12 seconds (changed to 72) 5 seconds 12 seconds The first time ATE uses a typeface is its slowest. After it almost doubles in speed. This will also depend on your hard disk apeed. Yeah, yeah, I know, Prefs/Font doesn't show all the characters and since I'm only drawing characters as I need, of course it's gonna be faster. That's my point; in the USA and most English speaking countries we don't use half the character set, so why waste time drawing it? And those in non-English countries use only a fraction of the whole non-English charset anyway. This style of handling characters comes right out of Gold Disk's CG font handler from Professional Page. It too, draws characters only as needed, as does ATM for Windows or the Macintosh. That's not all. If you have multiple styles of a typeface (such as Times-Roman, Times-Bold, Times-Italic, Times-BoldItalic) ATE will use the true styles when programs ask for styles in OpenDiskFont() or even if they cheat and use SetSoftStyle() on the normal style. Deluxe Paint IV for example, will use true italics and true bolds, wether it likes it or not. Thphth. ATE works with any typefaces that work with post.library V17. These include Type 1 ASCII, Type 1 Binary, Type 3, that weird format Gold Disk uses, I think Nimbus-Q, and whatever. It will spit out any font size you ask it, and keep itself organized if you run low on memory. Further system patches: (1) OpenDiskFont() patch to keep track of loaded ATE fonts for the Text() patch, and of course, to generate the TextFont to draw in. (2) SetSoftStyle() patch to swap fonts behind some apps' back, in case they open the normal style then blatantly SetSoftStyle() to get bold or italic. Most EA apps do this. (3) AvailFonts() patch to insert ATE fonts into lists for apps. (4) Patch to diskfont.library's Expunge() function to free all unopened fonts and "re-start" the PS interpreter in low memory conditions. Many of these patches I will make obsolete, particularly the AvailFonts() patch, as I begin to move this towards a bullet-style library, and make the remaining patches optional. I can use input on this idea. *********************************************************************** 2) OK you convinced me. What do I need to run ATE? You need: An Amiga (Obvious. If you have a DOS box what are you doing reading AC?) Kickstart 2.04 and Workbench 2.04 or better (You don't need V37 diskfont) 2 MB memory (All AGA machines should handle this. Minimum 1 MB Fast RAM) A properly installed hard disk with all the right stuff in your C: directory. I depend on these for the installer. These things will make ATE nicer to use: A 68020 / 68881 processor combination or better Typefaces from ATM for Windows (Times, Helvetica, Symbol, Courier) AC's Weird Science Multimedia Toolkit (180 PostScript typefaces!) *********************************************************************** 3) How to install ATE without ripping your hair out The included IconX script will install ATE for you. It will check your processor types and check if you already have a version of post.library installed, so HWGPOST users can safely install this without losing their existing POST setup. To Install: Click on the "InstallATE" icon. If it asks you to insert a volume labeled "PSFonts:" just cancel it. Or you can type "InstallATE" from a Shell. Here's where the script should put everything: Fonts:_ATE_#? your FONTS: directory PSfonts:#? makes a PSfonts dir and copies all this here PSfonts:init.ps if you don't have one, it puts one here PSfonts:AFMs/#? makes an AFMs dir in the PSfonts dir and copies all this here Libs:post.library or post.library.2620 copies one of these to LIBS: and renames it if necessary to read "post.library" SYS:WBStartup/ATEbeta4d main executable SYS:WBStartup/ATEbeta4d.info icon for main executable The script also looks for an existing assign of PSFonts: and if it can't find one, will add to, or create a S:User-Startup file to put an Assign command there. Notice this does not copy typeface files for Times, Helvetica, Symbol, or Courier families. It provides .afm and _ATE_ files for them, but you will get errors or FunkyFont if you open these. I only provided the .afm and _ATE_ files for the convenience of licensed users of these typefaces. Grab ATM for Windows to get them. *********************************************************************** 4) Got everything in the right places? Here's how you run it: Either type: ATEbeta4d at a command prompt, or double-click its icon. To unload ATE and all its fonts, type: ATEbeta4d -exit or double-click the icon a second time. There are other parameters you can use as well. You can use these either when starting ATE, or to update settings for an existing process of ATE: -trace Enable trace message displaying. I have messages imbedded in the code that show up if you use this switch. -notrace Disables trace message displaying. This is the default. -debug If you like seeing lots of crap on the screen, this switch displays every PS command ATE uses. Might be useful for troubleshooting problem typefaces. -nodebug Turns debugging crap off. This is the default. -softstyleson Ever see smeared bolds or fake italics? If a typeface doesn't have styles installed, this switch will enable the system to use algorithmic (soft) styles on ATE fonts. I would advise against using this switch and get true styles for your typefaces instead. -softstylesoff Disables algorthmic styles on ATE typefaces that don't have built in styles. Soft styles on other Amiga fonts will still work. This is the default. -hidediskfonts Ever see the "Show only TrueType fonts in applications" switch? This parameter mimicks that function. Apps that use AvailFonts() to call up font lists will only show TextFonts in RAM and ROM and ATE fonts. Opening known diskfonts (like terminal programs do) still works. -showdiskfonts Shows all Amiga and ATE fonts in app lists. Default. -availfonts sm si This tells ATE what sizes of fonts to show to apps. sm = size maximum, si = size increment. Defaults are 72 6 to show font sizes 6 12 18 24 30 36 42 48 54 60 66 72 -dpi dp -dpi sets the drawing resolution for the screen. The industry standard (or the industry consensus rather) is 72 dots per inch, and that is also my default. (-dpi 72) Amiga apps like to use 75 DPI for some stupid reason. If you have ProWrite and your printing seems squished at large sizes, try using -dpi 75. You must close all apps using ATE before using this switch. -exit Tells ATE to unload itself and all resources it used. It undoes all patches if it can safely do so, and unloads all ATE fonts from memory. You must close all apps using ATE before using -exit. I have safety locks to prevent exiting or -dpi changes if any apps still have ATE fonts open. Yes you can add more typefaces to ATE, if you don't mind getting your hands dirty with your favorite text editor. ATE uses files with the prefix _ATE_ to identify PostScript typefaces and AFM files that corespond with _ATE_ fonts. I included _ATE_s for the typefaces that come with ATM for Windows, just to get you started. You can add more by copying an existing ATE file and renaming it, and editing the contents. These files sit in FONTS: but they aren't affected by FixFonts. Here's a sample for Times-Roman, a pretty standard typeface: S 32 255 .Times-Roman S 32 255 .Times-Bold S 32 255 .Times-Italic S 32 255 .Times-BoldItalic Remember to add an extra RETURN to the end of the last line. The S means Standard Encoding (translate to Amiga encoding), the 32 255 are the first and last characters supported by this typeface, and the .fontname is the PostScript name of the typeface. For the first face on the list, you also need: PSfonts:Times-Roman PSfonts:AFMs/Times-Roman.AFM in your PSfonts directory. If you want true styles, you need the typeface and AFM file for each style as well. I also included AFM files for the ATM Windows typefaces, as they are free, and ATM for Windows doesn't use AFM files. WARNING: Some AFM files will have CR/LF or just CR at the end of their lines, because of MS-DOG :) or Macintosh text formats. You must convert these files to Amiga format text (LF). CrossDOS can do this, as can some CD-ROM file systems. For a typeface without styles, copy the same line to all four entries: S 32 126 .FunkyFont S 32 126 .FunkyFont S 32 126 .FunkyFont S 32 126 .FunkyFont This tells ATE to use the normal typeface and not build a styled font. Notice this _ATE_ file also specifies ASCII codes 32 to 126; this typeface does not support characters beyond ASCII 126. For font specific encoded typefaces (like symbol sets or dingbats) use something like this: F 32 255 .Symbol F 32 255 .Symbol F 32 255 .Symbol F 32 255 .Symbol In this case, the "S" was replaced by an "F" for "Font Specific". *********************************************************************** 5) Printing nice text with ATE (I need help here) There is no standard way to draw graphics to a printer on the Amiga. ATM for the Mac and for Windows depend on the same drawing functions for the printer as well as the screen, which is why ATM works so well on those systems. On the Amiga, there's no such thing. Heck, some apps don't even call Text() to draw on the screen! What's with you guys? So, here are some OS friendly suggestions for developers, that will let you print excellent type on non-PostScript printers using ATE: (1) Use graphics.library to draw to high resolution bitmaps, and dump them to the printer. This lets you use Text() to draw with. Apparently, I can safely load TextFonts into Fast RAM, so theoretically one could allocate Bitmap structures in Fast RAM and draw in them, even though it can't display them. Apparently, ProWrite 3.3 does this and you can get excellent print quality, provided your AFM files are accurate. (2) If you can't draw into Fast RAM bitmaps, use a "strip" print method like Professional Page used; Allocate a bitmap in Chip RAM, as wide as, but only a fraction of the height, of your page. Draw into it, dump it to the printer, then draw and dump the next strip. Again use graphics.library. OK those two crazy suggestions are outrageous and will leave ridiculous sized TextFonts in memory after the printing. Hence the third suggestion which will work in the commercial version of ATE: (3) Use NewScaledDiskFont() to ask for a huge TextFont (or actually a DiskFont) which won't get added to the system list, print with it, then UnLoadSeg() it when finished. The advantage of this method is ATE will draw the entire charset, directly support unusual DPI settings (for Epson class printers with 120x144 DPI for example), and maybe introduce some new tagitems that the OS will ignore, but ATE will respond to, EG: only draw characters from ASCII codes X to Y, or something, and last but not least, you can draw however you want to! The NewScaledDiskFont() technique is proven on newer beta versions of ATE. I can successfully request a font with a weird DPI (like 120 x 144) and draw it to the screen or print with it. For app writers interested, E-MAIL me with your credentials and I'll send you the latest beta. If you have better suggestions for handling printing that works with ALL Amiga fonts (not just with ATE; I don't want apps to become propeietary to ATE) please E-MAIL me your suggestions or phone my voicemail and leave a message. *********************************************************************** 6) Bugs fixed since ATMbeta3d from comp.binaries.amiga Yes I am guilty of releasing ATMbeta3d to the Internet. My intent was to spread the word that a real "type manager" was coming to the Amiga with real good capabilities and real speed. And it almost worked; I still get requests for ATMbeta3d. I am saddened that Adobe Systems would not support nor allow an "ATM" product for this "fringe" system. Adobe: It's your loss. Thphth. Anyway I fixed some nasties from that first release. (1) Better OpenFont checking. Kickstart 3.0 version of OpenDiskFont() doesn't call OpenFont() after it loads a new diskfont. I first counted open ATM fonts via a patch to OpenFont(). This patch is now removed and it checks the TextFont tf_Accessors for each _ATE_ font instead. (2) Safer AvailFonts() patch. Originally I had pointers to the font names and tags pointing to one instance of the names or tags. Now I copy the names and tags to the memory space the app sets aside for the AvailFonts structures. This allowed DPaint IV non-AGA and Prefs/Font to work nicely again. (3) Friendlier on low memory systems, but with a performance cost. In a memory panic (Avail Flush or otherwise) ATE will unload all _ATE_ TextFonts with their tf_Accessors at zero (unopened). It will also "re-boot" the PostScript activation I use to do the drawing, which unloads cached typefaces from memory. This frees all but 128 KB in a panic. The performance loss comes when you try to re-load fonts that got un-loaded. It seems DPaint IV non-AGA and Deluxe PhotoLab like to invoke memory panics often, and you'll see that when you run these apps and the HD light starts flashing like mad. These are the only apps I know that do this. (4) Streamlined PS commands. I forego many safety features of PostScript now, in the name of speed. I depend on AFM files to get accurate spacing and bounding box info to avoid over-running other characters, but this yields a 1/3 speed increase over Beta3d. If you find parts of other characters overrunning each other, try getting an updated AFM file from wherever you got the typeface from. If hwgpost.library supports the callextfunc operator from post.library V17 I can correct AFM files when installing new typefaces. (5) Name change (of course). This was a legal bug. :) (6) Removed post V17 dependancies. This will work on HWGPOST up to Beta 6 (V22), but you need to use the init.ps which came with HWGPOST. If you have HWGPOST, DO NOT use the included init.ps!!! Use HWG's instead!!!!! *********************************************************************** 7) Known bugs with ATE beta 4d No new product isn't without bugs (look at Windows 95. Thphth.) and here's a few you should watch out for when using this wicked little hack. (1) DPaint IV non-AGA I hate this program. This is the only app I tested with that just does not like my AvailFonts() patch. When you scan a font list you will end up losing your last few fonts in the list (IE: I lost from Saphire to Zapf Dingbats). No other EA app does this, no other app PERIOD does this. The AGA version uses asl.library so use that instead, if you can. (2) DTP programs that use their own typeface handlers All Amiga DTP programs since PPage 1.3 are guilty of not calling the OS to draw text. Since I'm trying to speed things up by drawing characters as needed, and these programs don't call Text(), nothing gets drawn! Oh the spacing is there, and the characters are there, but they're just... ...empty. I refuse to take reponsibility for this. DTP authors: Use the OS like you're supposed to. And maybe you can save a few MB by supporting ATE instead of writing your own typeface handlers. (OK that was a bit drastic... ASDG's Art Department Pro also doesn't use Text(), so I'm moving the rendering engine to a bullet style library and making the Text() and SetSoftStyle() patches optional. However, if App writers and users want outline type to be FAST, USE THE OS!!!!!) (3) Weird spacing problems with DVideo III This is going to happen with any app that blatantly opens the normal style, then SetSoftStyle()s it to go to bold or italic. The problem is: these apps also call TextLength() to find out how much space they need, and that spacing is based on the normal font, not the font I switch to when they actually draw. I need to patch TextLength() and TextExtent() to help solve this, but the best solution is to *TRY* opening fonts with style bits set in the TextAttrs. ARKM:Libraries 3rd edition has a perfect example of how to use SetSoftStyle() nicely. In the meantime, this DVideo III problem you can avoid by adding extra spaces to the end of any bold text. (Oh yes... DVideo III has Enforcer and Mungwall problems by itself too. Don't blame ATE for those.) (4) Memory loss after exiting This one I do take responsibility for. Somehow I lose 800 bytes when ATE exits. I can't tell which ROM functions did it by just by looking at the Snoop output Mungwall gave me. I can use any and all assistance to track down this memory loss. (5) Adding or Removing diskfonts while ATE runs To speed up calls to AvailFonts() I try to pre-scan the diskfont list to see how much memory it would take. Excellence! 3.0 would always scan twice; once to find out how much RAM, and second to actually load all the TextAttrs. Adding diskfonts behind ATE's back may cause ATE to over-run AvailFonts memory allocations. If I didn't do this it would probably call the original AvailFonts() more than just twice. If you add any ATE or disk fonts to the system while you have an active ATE running, you can merely use -hidediskfonts -showdiskfonts in that order on one command line. This re-scans the Amiga font list size and re-scans the _ATE_ files in FONTS:. And no, this isn't the cause of my troubles with DPaint; I use AFF_TAGGED when doing the inital scan, so I force apps to use more RAM than they actually require for non-tagged AvailFonts. (6) I get FunkyFont instead of the font I wanted Check to make sure the typeface in question really works. Some fonts converted over from Macintosh resource files will have extra garbage before the %!PS-AbobeFont and after the cleartomark statements. Kill 'em. Also, make sure it's in your PSFonts directory. (7) Print spacing really sucks on some fonts I depend more on AFM files than regular POST does for two reasons. One: speed (pre-read bounding box info) and two: spacing. It's for this reason that italic fonts look so nice. But... if you have AFMs from some poorly converted typeface you might find characters overlapping. Check with the typeface vendor for updated AFM files. I will fix this in the font installer, which will correct AFM files as it installs them. (8) Ugly, ugly, console window Yes I know... I don't want to complicate things with pretty AutoRequest thingys just yet. They'll be there in the commercial release. *********************************************************************** 8) Ideas for commercial release (I need help here too!) GUI for installing typefaces and setting ATE options. Currently using GadToolsBox 2.0 by Jan van den Baard (JABA Development) to make a nice font-adaptive GUI without using any stupid interface addons like MUI. I read too many horror stories about MUI et al to waste my time with them. We don't need any MS-Windows clones on the Amiga. (and here I am talking about porting Adobe Type Manager...) The installer will also correct or add bounding box info, and maybe convert .PFM files. I can correct bbox info by reading it from the typeface itself. .PFMs don't include bbox info, so conversions will require lots of planning. NewScaledDiskFont() add-on described in Printing section. This is the best way I see, so far, to support printing and not clog up memory with huge TextFonts in the system list. Maybe an interface or .otag or whatever, to provide kerning information to apps. Apparently the Amiga has a standard interface for receiving kerning pair info. Currently though, the AFM files provide kerning info if apps don't mind wading through them. (I'm planning a move over to a bullet style library with optional patches instead, so the .otag will be reality in the commercial version if I get enough demand for it. ATE works on WB 2.04; bullet and type1 do not. Thphth.) And anything else reasonable you might ask for. :) *********************************************************************** Copyright Information This release is for Amiga Compting magazine customers and anyone else who happens to get their hands on their coverdisks. Do not re-distribute without my permission. Users not receiving AC can get ATEbeta4d by E-MAILing me. You may not re-distribute altered archives AT ALL. You may add your own installers etc so long as you do not change the original files in the archive, and see me for re-distribution permission. Adobe Type Manager and "ATM" are trademarks of Adobe Systems Inc Professional Page is a product of Gold Disk, Inc MS-Windows and Windows 95 belong to Microsoft (they can keep it.) Macintosh is a product of Apple Computer Inc Original MKBMAP source code I lifted from Adrian Aylward's MKBMAP arcive. This provided the spark I needed to get this thing going. post.library and #?.ps init files by Adrian Aylward from POST 1.7 FunkyFont from Radical Eye software, assumed freeware as it shipped with POST 1.7 Various typeface names are trademarks of their respective holders Amiga Typeface Engine and "ATE" are not currently trademarks but I'd rather call this something else anyway DPaint, DVideo, DPhotoLab are products of Electronic Arts Many thanks go to: My beta testing crew who shall remain nameless for now, as these guys get later versions of ATE than any of you ever will. Thanks guys! Heinz Wrobel for giving a good kick in the... And for making HWGPOST as fast as it is. If more users demand it I will get that bullet style library done for the commercial release... Many internet users who answered my stupid questions. List coming in commercial release. Adobe systems for nothing. Thphth. (OK they did mail me some AFM files for free. Thanks for that.) Amiga Computing magazine for actually publishing this pre-release. You guys want to market the commercial release? :) *********************************************************************** Contact Information Gordon Fecyk BSMT 5531 McRae Street Richmond, BC V6V 2P5 Canada +1-604-526-8724 (24 hour voice mail) gordonf@freenet.vancouver.bc.ca (24 hour flame-mail... heh heh)